package view;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Shader;
import android.view.View;

import androidx.annotation.NonNull;

public class RoundImage extends View {
    public RoundImage(Context context, Bitmap bitmap) {
        super(context);
        this.bitmap = Bitmap.createScaledBitmap(bitmap,400,400,false);
        init();
    }
    private void init() {
        mPaint = new Paint();
        BitmapShader bitmapShader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        mPaint.setShader(bitmapShader);
    }

    @Override
    protected void onDraw(@NonNull Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawCircle(200,180,100,mPaint);
    }

    private Paint mPaint;
    private Bitmap bitmap;
}
